{% extends "view/admin/ext_admin.html" %}
{% block extadmin %}
<section class="panel panel-default">
    <header class="panel-heading text-right bg-light  clearfix">
        <ul class="nav nav-tabs pull-left">
            <li class="{{'active' if ctx.action == 'index'}}"><a href="/{{ctx.controller}}/index">附件管理</a></li>
            <li class="{{'active'}}"><a href="/{{ctx.controller}}/api">{{controller.meta_title}}</a></li>
        </ul>
    </header>

    <div class="panel-body">
        <form action="/{{ctx.controller}}/update" class="form-horizontal" method="post" data-validate="parsley">

            <div class="form-group">
                <label class="col-sm-2 control-label">接口标识</label>
                <div class="col-sm-10">
                    <div class="row">
                        <div class="col-md-10"><input name="dis" type="text"
                                                      value="{{data.dis}}"
                                                      class="form-control" {%if not data.id%}data-required="true"
                                                      data-remote="/{{ctx.controller}}/checkext" {%endif%}></div>
                        <div class="col-md-12">
                                                    <span class="help-block m-b-none text-muted"><i
                                                            class="fa fa-info-circle text-info"></i>
                                                        英文字母.比如 你的标识是<code>biaoshi</code>那么请求接口就是 <code>/ext/attachment/adminfile/upload?type=biaoshi</code></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="line line-dashed b-b line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">表单name值</label>
                <div class="col-sm-10">
                    <div class="row">
                        <div class="col-md-10"><input name="name" type="text"
                                                      value="{{data.name}}"
                                                      class="form-control"></div>
                        <div class="col-md-12">
                            <span class="help-block m-b-none text-muted">
                                <i class="fa fa-info-circle text-info"></i>
                                默认为<code>file</code>,不需要留给留空
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="line line-dashed b-b line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">描述</label>
                <div class="col-sm-10">
                    <div class="row">
                        <div class="col-md-10"><textarea name="description" class="form-control">{{data.description}}</textarea></div>
                        <div class="col-md-12">
                            <span class="help-block m-b-none text-muted"><i class="fa fa-info-circle text-info"></i> 200字以内</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="line line-dashed b-b line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">水印</label>
                <div class="col-sm-10">
                    <div class="row">
                        <div class="col-md-10">
                            <label class="radio-inline i-checks">
                                <input type="radio" value="0" name="mark" {%if data.mark== 0 or data.mark==
                                       null%}checked {%endif%}><i></i> 禁用
                            </label>
                            <label class="radio-inline i-checks">
                                <input type="radio" value="1" name="mark" {%if data.mark== 1 %}checked {%endif%}><i></i>
                                开启
                            </label>
                        </div>
                        <div class="col-md-12">
                                    <span class="help-block m-b-none text-muted">
                                        <i class="fa fa-info-circle text-info"></i>开启后图片类型文件将添加水印<br>
                                    </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="line line-dashed b-b line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">路径</label>
                <div class="col-sm-10">
                    <div class="row">
                        <div class="col-md-10">
                            <input name="path" type="text" value="{{data.path}}" class="form-control">
                        </div>
                        <div class="col-md-12">
                                     <span class="help-block m-b-none text-muted">
                                        <i class="fa fa-info-circle text-info"></i>文件相对于服务器的路径,有默认值,不需要请留空<br>
                                    </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="line line-dashed b-b line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">类型</label>
                <div class="col-sm-10">
                    <div class="row">
                        <div class="col-md-10">
                            <label class="radio-inline i-checks">
                                <input type="radio" value="0" name="type" {%if data.type== 0 or data.type==
                                       null%}checked {%endif%}><i></i> 图片
                            </label>
                            <label class="radio-inline i-checks">
                                <input type="radio" value="1" name="type" {%if data.type== 1 %}checked {%endif%}><i></i>
                                文件
                            </label>
                        </div>
                        <div class="col-md-12">
                                            <span class="help-block m-b-none text-muted">
                                                <i class="fa fa-info-circle text-info"></i> 接口的类型<br>
                                                后台图片接口地址:<code>/ext/attachment/adminfile/uploadpic?type=接口标识</code><br>
                                                后台文件接口地址:<code>/ext/attachment/adminfile/upload?type=接口标识</code><br>
                                                前台图片接口地址:<code>/ext/attachment/homefile/uploadpic?type=接口标识</code><br>
                                                前台文件接口地址:<code>/ext/attachment/homefile/upload?type=接口标识</code><br>
                                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="line line-dashed b-b line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">接口返回规则</label>
                <div class="col-sm-10">
                    <div class="row">
                        <div class="col-md-7"><textarea name="rule" class="form-control" {%if not
                                                        data.id%}data-required="true" {%endif%}>{{data.rule}}</textarea>
                        </div>
                        <div class="col-md-12">
                                <span class="help-block m-b-none text-muted">
                                    <i class="fa fa-info-circle text-info"></i>
                                    输入接口返回规则，必填 ，<code>${id}</code>图片id<code>${url}</code>图片地址,<code>${name}</code>图片名称,默认接口只返回 id
                                </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="line line-dashed b-b line-lg pull-in"></div>
            <div class="form-group form-submit">
                <div class="col-sm-4 col-sm-offset-2">
                    {%if data.id%}
                    <input type="hidden" name="id" value="{{data.id}}"/>
                    {%endif%}
                    <button type="submit" target-form="form-horizontal"
                            class="btn btn-primary ajax-post">保存
                    </button>
                    <button type="submit" class="btn btn-default"
                            onclick="javascript:history.back(-1);return false;">返回
                    </button>
                </div>
            </div>
        </form>
    </div>
</section>
{% endblock %}
